home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.6 KB | 177 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWStyle.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSTYLE_H
- #define FWSTYLE_H
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTDDEF_H
- #include <FWStdDef.h>
- #endif
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWGROBJ_H
- #include "FWGrObj.h"
- #endif
-
- #ifndef FWGConst_H
- #include "FWGConst.h"
- #endif
-
- #ifndef FWPAT_H
- #include "FWPat.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _PLFMTYPE_
- #include <PltmType.h>
- #endif
-
- #ifndef _XMPTYPES_
- #include <XMPTypes.h>
- #endif
-
- // ----- Fundation Includes -----
-
- #ifndef FWSTRING_H
- #include "FWString.h"
- #endif
-
- //========================================================================================
- // •• Forward Class Declarations
- //========================================================================================
-
- class FW_CStyleRep;
- class FW_CGraphicContext;
-
- //========================================================================================
- // •• CLASS FW_CStyle
- //========================================================================================
-
- class FW_CStyle : public FW_CGraphicObjectPtr
- {
- public:
- FW_CStyle();
- FW_CStyle(XMPCoordinate penSize, const FW_CPattern& pattern = FW_kBlackPat);
- FW_CStyle(const FW_CDynamicString& fontName, FW_FontStyle fontStyle, XMPCoordinate fontSize);
- FW_CStyle(XMPCoordinate penSize, const FW_CPattern& pattern,
- const FW_CDynamicString& fontName, FW_FontStyle fontStyle, XMPCoordinate fontSize);
-
- FW_CStyle(const FW_CStyle& other);
- FW_CStyle(FW_CStyleRep* rep);
-
- FW_CStyle& operator=(const FW_CStyle& other);
- FW_CStyleRep* operator->() const;
- };
-
- //----------------------------------------------------------------------------------------
- // • FW_CStyle::operator->
- //----------------------------------------------------------------------------------------
- inline FW_CStyleRep* FW_CStyle::operator->() const
- {
- return (FW_CStyleRep*)GetRep();
- }
-
- //==============================================================================
- // •• class FW_CStyleRep
- //==============================================================================
-
- class FW_CStyleRep : public FW_CGraphicObjectRep
- {
- friend class FW_CStyle;
-
- //------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- private:
- FW_CStyleRep();
- FW_CStyleRep(XMPCoordinate penSize, const FW_CPattern& pattern);
- FW_CStyleRep(const FW_CDynamicString& fontName, FW_FontStyle fontStyle, XMPCoordinate fontSize);
- FW_CStyleRep(XMPCoordinate penSize, const FW_CPattern& pattern,
- const FW_CDynamicString& fontName, FW_FontStyle fontStyle, XMPCoordinate fontSize);
-
- virtual ~FW_CStyleRep();
-
- //------------------------------------------------------------------------------
- // • Inherited API
- //
- public:
- virtual void Flatten(FW_CWritableStream& stream);
- virtual void Unflatten(FW_CReadableStream& stream);
-
- //------------------------------------------------------------------------------
- // • New API
- //
- public:
- void SetPenSize(XMPCoordinate penSize);
- XMPCoordinate GetPenSize() const
- {return fPenSize;}
-
- void SetFontSize(XMPCoordinate fontSize);
- XMPCoordinate GetFontSize() const
- {return fFontSize;}
-
- void SetFontStyle(FW_FontStyle fontStyle);
- FW_FontStyle GetFontStyle() const
- {return fFontStyle;}
-
- void SetFontName(const FW_CDynamicString& fontName);
- void GetFontName(FW_CDynamicString& fontName) const
- {fontName = fFontName;}
-
- void SetPattern(const FW_CPattern& pattern);
- void GetPattern(FW_CPattern& pattern) const
- {pattern = fPattern;}
-
- FW_CStyle Copy() const;
-
- #ifdef FW_BUILD_MAC
- void GetMacFontInfo(short& textFont, Style& textFace, XMPCoordinate& textSize) const;
- #endif
-
- #ifdef FW_BUILD_MAC
- private:
- void CheckMacCache();
- #endif
-
- //------------------------------------------------------------------------------
- // • Public but for internal use only
- //
- public:
- FW_SPlatformPoint AsPlatformSize(FW_CGraphicContext* graphicContext, XMPCoordinate aSize);
- void SelectInGC(FW_CGraphicContext* gc, FW_ShapeCategory shapeCategory);
-
-
- //------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- XMPCoordinate fPenSize;
- FW_CPattern fPattern;
-
- FW_CDynamicString fFontName;
- FW_FontStyle fFontStyle;
- XMPCoordinate fFontSize;
-
- #ifdef FW_BUILD_MAC
- FW_Boolean fMacCacheValid;
- short fMacTextFont;
- Style fMacTextFace;
- #endif
- };
-
- #endif
-